package com.leyou.controller;

import com.leyou.Parameter;
import com.leyou.exception.ExceptionEnum;
import com.leyou.exception.SysException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    /**  测试用的Handler  start */
    @GetMapping("/home")
    public ResponseEntity<Parameter> testHome(){
        return ResponseEntity.ok(new Parameter("v1", "1"));
    }

    @GetMapping("/exception")
    public Object testException(Parameter parameter) throws SysException {
        if (1 == 1) {
            throw new SysException(ExceptionEnum.SERVER_EXCEPTION, parameter);
        }
        return null;
    }
    /**  测试用的Handler  end */

}
